package net.zjitc.service.impl;

import net.zjitc.dao.ProductDao;
import net.zjitc.dao.impl.ProductDaoImpl;
import net.zjitc.domain.Product;
import net.zjitc.service.ProductService;

import java.util.Date;
import java.util.List;

/**
 * @version 1.0
 * @autho 赵静静
 * @date 2018/10/16 12:45
 */
public class ProductServiceImpl implements ProductService {
  ProductDao dao = new ProductDaoImpl();
    @Override
    public List<Product> findAll() {
        return dao.findAll();
    }

    @Override
    public Product findById(String pid) {
        return dao.findById(pid);
    }

    @Override
    public int add(Product p) {
        p.setPdate(new Date());
        p.setCsid(1);
        p.setImage("products/1/cs10002.jpg");
        return dao.add(p);
    }
}
